﻿<UserControl x:Class="EpiDashboard.Controls.VariablesControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
             xmlns:Controls="clr-namespace:EpiDashboard.Controls"
             mc:Ignorable="d" 
             xmlns:EpiDashboard="clr-namespace:EpiDashboard">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../ResourceDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Rectangle Fill="White" Style="{DynamicResource shadowRectangleWhite}"></Rectangle>
        <Border Name="borderAll" CornerRadius="0" Style="{DynamicResource mainGadgetBorder}" >
            <Grid Visibility="Visible" x:Name="ConfigGrid" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="25,5,35,5" >
                <!--<Rectangle Fill="#22000000" RadiusX="10" RadiusY="10" Margin="0,4,0,0" />
                <Rectangle Fill="#775C90B2" Stroke="Gray"  RadiusX="10" RadiusY="10" Margin="0,0,0,5" />
                <Rectangle Fill="#DDFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="5,5,5,10" />-->
                <StackPanel Margin="5" HorizontalAlignment="Center" VerticalAlignment="Top" >

                    <Grid Name="grdFormattingProperties" Width="Auto" HorizontalAlignment="Center" Margin="2,2,2,2" Visibility="Visible">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="2"/>
                            <RowDefinition Height="140"/>
                            <RowDefinition Height="7"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="15"/>
                        </Grid.RowDefinitions>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="45"/>
                            <ColumnDefinition Width="120"/>
                            <ColumnDefinition Width="50"/>
                            <ColumnDefinition Width="165"/>
                        </Grid.ColumnDefinitions>

                        <TextBlock x:Name="txtHeader" Text="Variable Definitions:" Grid.Row="0" Grid.ColumnSpan="4"></TextBlock>

                        <ListBox x:Name="lbxRules" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="6" Width="377" />
                        <Grid Grid.ColumnSpan="4" Grid.Column="0" Grid.Row="4">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="115"/>
                                <ColumnDefinition Width="115"/>
                                <ColumnDefinition Width="115"/>
                            </Grid.ColumnDefinitions>

                            <Button x:Name="btnRemoveRule" Width="100" Content="Delete Variable" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Left" Click="btnRemoveRule_Click" />
                            <Button x:Name="btnEditRule" Width="100" Content="Edit Variable" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" Click="btnEditRule_Click" />
                            <Button x:Name="btnNewRule" Width="100" Content="New Variable" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" Click="btnNewRule_Click" >
                                <Button.ContextMenu>
                                    <ContextMenu>
                                        <MenuItem x:Name="mnuNewRecodeRule" Header="With Recoded Value" Click="mnuNewRecodeRule_Click" />
                                        <MenuItem x:Name="mnuNewSimpleAssignRule" Header="With Simple Assignment" Click="mnuNewSimpleAssignRule_Click" />
                                        <MenuItem x:Name="mnuNewConditionalAssignRule" Header="With Conditional Assignment" Click="mnuNewConditionalAssignRule_Click" />
                                        <MenuItem x:Name="mnuNewFormatRule" Header="With Formatted Value" Click="mnuNewFormatRule_Click" />
                                        <MenuItem x:Name="mnuNewExpressionAssignRule" Header="With Assigned Expression" Click="mnuNewExpressionAssignRule_Click" />
                                        <Separator/>
                                        <MenuItem x:Name="mnuNewGroupRule" Header="Create Variable Group" Click="mnuNewVariableGroupRule_Click" />
                                    </ContextMenu>
                                </Button.ContextMenu>
                            </Button>
                        </Grid>
                    </Grid>

                </StackPanel>
                <TextBlock x:Name="txtTitle"  HorizontalAlignment="Left" VerticalAlignment="Top" Width="150" TextWrapping="Wrap" TextAlignment="Center" Text="Defined Variables" FontWeight="Bold" >
                    <TextBlock.RenderTransform>
                        <RotateTransform Angle="90" CenterX="200" CenterY="221" />
                    </TextBlock.RenderTransform>
                    
                </TextBlock>
            </Grid>
        </Border>
    </Grid>
    
</UserControl>
